/**
 * @description res统一restfull
 */

class _Restfull {
    success<D = {}>(data: D, msg: string = "操作成功", code: number = 200) {
        return {
            code,
            msg,
            data
        }
    }

    faild(faildInfo: { code?: number, msg: string }) {
        const { code = 500, msg = "抱歉，出错了" } = faildInfo
        return {
            code,
            msg,
            data: {}
        }
    }
}
const Restfull = new _Restfull()
export {
    Restfull
}